/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aliyuncs.digitalstore.transform.v20200107;

import java.util.ArrayList;
import java.util.List;

import com.aliyuncs.digitalstore.model.v20200107.ListPrintTemplatesResponse;
import com.aliyuncs.digitalstore.model.v20200107.ListPrintTemplatesResponse.PrintTemplateModel;
import com.aliyuncs.transform.UnmarshallerContext;


public class ListPrintTemplatesResponseUnmarshaller {

	public static ListPrintTemplatesResponse unmarshall(ListPrintTemplatesResponse listPrintTemplatesResponse, UnmarshallerContext _ctx) {
		
		listPrintTemplatesResponse.setRequestId(_ctx.stringValue("ListPrintTemplatesResponse.RequestId"));
		listPrintTemplatesResponse.setSuccess(_ctx.booleanValue("ListPrintTemplatesResponse.Success"));

		List<PrintTemplateModel> printTemplates = new ArrayList<PrintTemplateModel>();
		for (int i = 0; i < _ctx.lengthValue("ListPrintTemplatesResponse.PrintTemplates.Length"); i++) {
			PrintTemplateModel printTemplateModel = new PrintTemplateModel();
			printTemplateModel.setTemplateId(_ctx.stringValue("ListPrintTemplatesResponse.PrintTemplates["+ i +"].TemplateId"));
			printTemplateModel.setTemplateName(_ctx.stringValue("ListPrintTemplatesResponse.PrintTemplates["+ i +"].TemplateName"));

			printTemplates.add(printTemplateModel);
		}
		listPrintTemplatesResponse.setPrintTemplates(printTemplates);
	 
	 	return listPrintTemplatesResponse;
	}
}